#coding:gbk
from socket import *


def main():
    HOST = 'localhost'
    PORT = 8024
    ADDR = (HOST, PORT)
    
    try:
        sockClient = socket(AF_INET, SOCK_STREAM)
        sockClient.connect(ADDR)
    except:
        print("connect error may be the server has shutdown \r\n")
        return
    
    while True:
        data = "manual\r\nhttp://baidu.com\r\n"
        if not data:
           break
        sockClient.send(data)
        data = sockClient.recv(1024)
        if not data:
           break
        print data
    sockClient.close()




if __name__ == '__main__':
    main()


